package fr.pascal.client.activity;

import com.google.gwt.activity.shared.AbstractActivity;
import com.google.gwt.event.shared.EventBus;
import com.google.gwt.user.client.ui.AcceptsOneWidget;

import fr.pascal.client.ClientFactory;
import fr.pascal.client.place.ChatPlace;
import fr.pascal.client.place.KangourouPlace;
import fr.pascal.client.ui.animal.KangourouView;

public class KangourouActivity extends AbstractActivity implements KangourouView.Presenter {

	private ClientFactory clientFactory;
	private KangourouPlace kangourouPlace;

	public KangourouActivity(ClientFactory clientFactory, KangourouPlace kangourouPlace) {
		this.clientFactory = clientFactory;
		this.kangourouPlace = kangourouPlace;
	}

	@Override
	public void start(AcceptsOneWidget panel, EventBus eventBus) {
		KangourouView kangourouView = clientFactory.getKangourouView();
		kangourouView.setNomKangourou(kangourouPlace.getToken());
		kangourouView.setPresenter(this);
		panel.setWidget(kangourouView.asWidget());
	}

	@Override
	public void goTo(ChatPlace chatPlace) {
		clientFactory.getPlaceController().goTo(chatPlace);
	}
}
